import request from '@/utils/request'

/**
 * 查询待办列表列表
 * @param query
 */
export function todoList(query) {
  return request({
    url: '/act/task/todoList',
    method: 'get',
    params: query
  })
}

/**
 * 查询已办列表
 * @param query
 */
export function hiList(query) {
  return request({
    url: '/act/task/hiList',
    method: 'get',
    params: query
  })
}

/**
 * 历史任务管理
 * @param query
 */
export function hiTaskManager(data) {
  return request({
    url: '/act/task/hiTaskManager',
    method: 'post',
    data: data
  })
}

/**
 * 根据待办ID获取待办信息
 * @param id
 */
export function getTask(id) {
  return request({
    url: '/act/task/getTask/' + id,
    method: 'get'
  })
}

/**
 * 根据待办ID获取待办信息
 * @param id
 */
export function getTaskStatus(taskId) {
  return request({
    url: '/act/task/getTaskStatus/' + taskId,
    method: 'get'
  })
}

/**
 * 查询来源节点用于驳回
 * @param id
 * @returns {AxiosPromise}
 */
export function getHistoryNode(id) {
  return request({
    url: '/act/task/getHistoryNode/' + id,
    method: 'get'
  })
}

/**
 * 提交待办
 * @param completeData
 */
export function complete(completeData) {
  return request({
    url: '/act/task/complete',
    method: 'post',
    data: completeData
  })
}

/**
 * 签收待办
 * @param taskId
 */
export function claimTask(taskId) {
  return request({
    url: '/act/task/claimTask/' + taskId,
    method: 'get'
  })
}

/**
 * 流程撤回校验
 * @param taskId
 */
export function withdrawCheck(taskId) {
  return request({
    url: '/act/task/withdrawCheck/' + taskId,
    method: 'get'
  })
}

/**
 * 流程撤回
 * @param taskId
 */
export function withdrawTask(taskId) {
  return request({
    url: '/act/task/withdrawTask/' + taskId,
    method: 'get'
  })
}

/**
 * 校验任务是否可以驳回
 * @param taskId
 */
export function rejectedCheck(taskId) {
  return request({
    url: '/act/task/rejectedCheck/' + taskId,
    method: 'get'
  })
}

/**
 * 查询待办数量
 * @param query
 */
export function todoCount() {
  return request({
    url: '/act/task/todoCount',
    method: 'get'
  })
}

/**
 * 提交补充意见
 * @param completeData
 */
export function saveSupplementaryComments(completeData) {
  return request({
    url: '/act/task/saveSupplementaryComments',
    method: 'post',
    data: completeData
  })
}

/**
 * 查询补充意见
 * @param query
 */
export function findSupplementaryComments(query) {
  return request({
    url: '/act/task/findSupplementaryComments',
    method: 'get',
    params: query
  })
}

/**
 * 暂存
 * @param completeData
 */
export function actTaskOpinionStaging(completeData) {
  return request({
    url: '/act/task/actTaskOpinionStaging',
    method: 'post',
    data: completeData
  })
}

/**
 * 获取上一节点信息(返回上一节点修改意见时使用)
 * @param completeData
 */
export function getUpdateCommentUserList(taskKey, actId) {
  return request({
    url: '/act/task/getUpdateCommentUserList/' + taskKey + '/' + actId,
    method: 'get'
  })
}
